package cn.zyy.hotel.service.impl;

import cn.zyy.hotel.dao.FloorMapper;
import cn.zyy.hotel.entity.Floor;
import cn.zyy.hotel.service.FloorService;
import cn.zyy.hotel.vo.FloorVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class FloorServiceImpl implements FloorService {

    @Resource
    private FloorMapper floorMapper;

    //查询楼层列表
    public List<Floor> selectFloorList(FloorVO floorVo) {
        return floorMapper.selectFloorList(floorVo);
    }

    //添加楼层
    public int addFloor(Floor floor) {
        return floorMapper.addFloor(floor);
    }

    //修改楼层
    public int updateFloor(Floor floor) {
        return floorMapper.updateFloor(floor);
    }

    //查询当前楼层下是否存在房间
    public int getRoomCountByFloorId(Integer floorId) {
        return floorMapper.getRoomCountByFloorId(floorId);
    }

    //删除楼层
    public int deleteById(Integer id) {
        return floorMapper.deleteById(id);
    }

}
